package cn.gdcp.democ;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class AddScoreActivity extends AppCompatActivity {
private Button save_student_score;
private EditText edit_stuno;
private EditText edit_android;
private EditText edit_english;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_score);
        initBundler();
        save_student_scoreEvent();
    }

    private void save_student_scoreEvent() {
           save_student_score.setOnClickListener(new View.OnClickListener() {
               @Override
               public void onClick(View view) {
                   Intent intent=new Intent();
                   String stuno=edit_stuno.getText().toString();
                   int android=Integer.valueOf(edit_android.getText().toString());
                   int english=Integer.valueOf(edit_english.getText().toString());
                   intent.putExtra("STUNO",stuno);
                   intent.putExtra("ANDROID",android);
                   intent.putExtra("ENGLISH",english);
                   setResult(2001,intent);
                   finish();
               }
           });

    }

    private void initBundler() {
           save_student_score=findViewById(R.id.save_student_score);
           edit_stuno=findViewById(R.id.edit_name);
           edit_android=findViewById(R.id.edit_android);
           edit_english=findViewById(R.id.edit_english);

    }
}
